package com.yeyks.common.em;

/**
 * @Author fuchangshuai
 * @date 2019/3/4 7:50 PM
 */
public enum StarLevelEnum {
    HOMESTAY(2, "民宿"),
    THREESTAR(3, "三星级酒店"),
    FOURSTAR(4, "四星级酒店"),
    FIVESTAR(5, "五星级酒店"),
    BUSINESS(6, "商务酒店");
    int value;
    String desc;

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    StarLevelEnum(int value, String desc) {
        this.value = value;
        this. desc = desc;
    }

    public Integer value() {
        return this.value;
    }
    public String desc() {
        return this.desc;
    }

    public static String getDesc(int value) {
        StarLevelEnum[] starLevelEnums = values();
        for (StarLevelEnum starLevelEnum : starLevelEnums) {
            if (starLevelEnum.value() == value) {
                return starLevelEnum.desc();
            }
        }
        return null;
    }

    public static Integer getValue(String desc) {
        StarLevelEnum[] starLevelEnums = values();
        for (StarLevelEnum starLevelEnum : starLevelEnums) {
            if (starLevelEnum.desc().equals(desc)) {
                return starLevelEnum.value();
            }
        }
        return null;
    }
}
